function register() {
	let button = document.getElementById('btn-register');
	button.disabled = true;
	let formData = new FormData(document.querySelector('form'));
	let request = new XMLHttpRequest();
	request.open('POST', '/register');
	request.onload = function (e) {
		let response = JSON.parse(e.target.response);
		if (response.error === 0) {
			toast('注册成功');
			setTimeout(function () {
				window.location.href = '/login';
			}, 2000);
		} else {
			toast('注册失败，原因：' + response.data.what);
		}
		button.disabled = false;
	};
	request.send(formData);
}
